home *** CD-ROM | disk | FTP | other *** search
- unit RXVWShell;
-
- {RXVW Shell for ResX Views}
-
- {To compile in Think Pascal:}
-
- { 1) Set Project Type to 'Code Resource' }
- { 2) Set the File TYPE to 'RXXT' and File Creator to 'ResX'}
- { 3) Set the Resource TYPE to 'RXVW' }
- { 4) Set the Resource NAME to the resource type you are making a view for. }
- { If you are making an ICON editor/viewer, set the name to 'ICON' }
- { 5) Add this file, DRVRRuntime.lib, and Interface.lib to the project }
- { 6) Compile/Build the code resource. }
- { 7) Install it in ResX via the 'Externals->Install' menu. Or double-click on the external file in Finder. }
-
-
-
-
- {PRE-CONDITIONS}
- { 1) The handle to the current selected resource is passed directly into main.}
- { 2) The resource of that handle is NOT loaded. It must be loaded if used.}
- { 3) The handle to the resource is NOT detached so all resource info can be found on the handle.}
- { 4) The Global Data is stored in the reference constant of the daWindow. See example below on}
- { how to access the globals.}
- { 5) It is mandatory to get the state of the handle (HGetState). Restore the state when finished.}
-
-
- {POST-CONDITIONS}
- { 1) Do NOT release the resource or dispose the handle to the resource. ResX will do it when}
- { necessary. ResX will check to see if the resource has been loaded by another environment.}
- { 2) Restore the state of the handle when finished (HSetState).}
-
-
-
-
-
-
- interface
- procedure main (ResHandle: Handle); {Handle of the current selected resource}
-
-
- implementation
- procedure main;
- type
-
- SettingsHandle = ^SettingsPtr; {Contains Configuration setup, last and second}
- SettingsPtr = ^SettingsRec; {to last files opened, and last move info}
- SettingsRec = record
- unused1: Boolean;
- openStartup: Boolean; {Enable/Disable Open on Startup options}
- sortTList, sortRList: Boolean; {Sort Type/Resource list}
- lastOneRefNum, lastTwoRefNum: integer; {Last/Second to last volume reference number}
- lastOneName, lastTwoName: Str255; {Last/Second to last file name}
- lastMoveType: ResType; {TYPE of the last resource copied}
- lastMoveID: integer; {Resource ID of the last resource copied}
- lastMoveSource, lastMoveDest: Str255; {Source and Dest Files of the last resource copied}
- onStartup: integer; {Open on startup option: 1-Last File, 2-Last Two Files, 3-Open File Dialog}
- unused2: integer;
- dClick: integer; {Current selected item of DoubleClick popup menu}
- helpFName: Str255; {Location of master Help file}
- end;
-
-
-
- GlobalsHndl = ^GlobalsPtr; {ResX Global Data - Some data can be programmably}
- GlobalsPtr = ^GlobalsRec; {altered. Alter with care! * denotes DO NOT alter}
- GlobalsRec = record
- theDevCtlEnt: DCtlPtr; {*Device Control Entry for DA*}
- rsrcBase: Integer; {*Resource Base*}
- daMenu: MenuHandle; {Main DA Menu}
- daFileID: Longint; {*File ID of DA*}
-
- LeftFName, RightFName: Str255; {Path and Name of Left & Right files currently opened}
- LeftVNum, RightVNum: integer; {vRefNum of Left & Right files}
- LWasOpened, RWasOpened: Boolean; {Left/Right file was opened priorly and shouldn't be closed}
- LcurType, RcurType: ResType; {Current type displayed above resource lists}
- LTcurCell, RTcurCell: Cell; {Current selected cell in Left/Right TYPE list}
- LRcurCell, RRcurCell: Cell; {Current selected cell in Left/Right RESOURCE list}
- LfileID, RfileID: integer; {Left/Right File ID}
- prefsID: integer; {File ID of ResX Prefs in the System Folder}
- CompactLeft, CompactRight: Boolean; {Left/Right resource map will be compacted when closed if TRUE}
- favMenu, extMenu, openMenu: MenuHandle; {*Favorite File/Externals/Open File MenuHandles}
- Lopen, Ropen: Boolean; {True if Left/Right file is open and displayed in ResX}
- MFActive: Boolean; {*True if MultiFinder is running*}
- Settings: SettingsHandle; {Handle to Settings in Configuration setup}
-
- LTypeList: ListHandle; {Handle to Left Type list}
- RTypeList: ListHandle; {Handle to Right Type list}
- LResList: ListHandle; {Handle to Left Resource list}
- RResList: ListHandle; {Handle to Right Resource list}
-
-
- Info: ControlHandle; {Get Info Button Control Handle}
- View: ControlHandle; {View Button Control Handle}
- OpenLeft: ControlHandle; {Open Left Button Control Handle}
- OpenRight: ControlHandle; {Open Right Button Control Handle}
- Remove: ControlHandle; {Remove Button Control Handle}
- Copy: ControlHandle; {Copy Button Control Handle}
-
-
- end; {DO NOT alter globals denoted with *. They can}
- {be accessed for reference only.}
-
-
-
- var
- fileID, rsrID: integer;
- rsrType: ResType;
- rsrName, fName: Str255;
- HState: SignedByte;
- MF: Boolean;
- Globals: GlobalsPtr;
-
- begin
- Globals := GlobalsPtr(WindowPeek(FrontWindow)^.refCon); {Required to access the Global Data}
-
-
- {Sample of accessing the global data: }
- fileID := Globals^.LFileID; {Get the file id left file}
- fName := Globals^.LeftFName; {Get the file name of the left file}
- MF := Globals^.MFActive; {Is MultiFinder running?}
-
-
- HState := HGetState(ResHandle); {This is mandatory!}
-
-
- LoadResource(ResHandle); {This is necessary if you plan to use it. }
- {ResX doesn't load it.}
-
-
-
- {.......}
- {main code here}
- {.......}
-
-
-
- HSetState(ResHandle, HState); {This is mandatory!}
-
- {Do NOT release the resource or dispose the handle, ResX will do it if necessary. }
- {This is critical in case the resource is being used by a currently running application. }
-
- end;
- end.